package com.showde.shoppingmall.netentity;

import android.util.Log;

import com.kim.net.NetEntity;
import com.showde.shoppingmall.utils.URLS;

public class ProductEntity extends NetEntity {

	private static final String TAG = "ProductEntity";

	public enum FETCHTYPE {
		product_details, product_summary
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = -2355815209317183614L;

	private String productCategoryId;
	private String productId;
	private boolean isProductDetails;
	private boolean isProductSummary;

	public ProductEntity(String productCategoryId) {
		this.productCategoryId = productCategoryId;
	}

	/**
	 * 获取商品详情
	 * 
	 * @param productId
	 * @param isProductDetails
	 *            必须为真
	 */
	public ProductEntity(String productId, FETCHTYPE fetchtype) {
		this.productId = productId;
		switch (fetchtype) {
		case product_details:
			this.isProductDetails = true;
			this.url = URLS.URL_PRODUCT_DETAILS;
			break;
		case product_summary:
			this.isProductSummary = true;
			break;
		}
	}

	@Override
	public String getSendData() {

		String sendData = "";

		if (isProductDetails) {
			sendData = "{\"GoodsId\":" + this.productId + "}";
		} else if (isProductSummary) {
			sendData = "{\"Id\":" + this.productId + "}";
		} else {
			sendData = "{\"TypeId\":" + this.productCategoryId + "}";
		}
		Log.d(TAG,
				String.format("requestUrl:%s|sendData:%s", this.url, sendData));
		return sendData;
	}

	@Override
	protected void init() {
		this.url = URLS.URL_PRODUCT;
	}

	@Override
	protected void initHttpHeader() {
	}

	/*
	 * { "ReturnCode": 0, "info": { "COLORS": "qwe,123", "PRICE": 76,
	 * "VIPPRICE": 64, "NAME": "韩版2013夏装新款女装", "POINT": 50, "SIZES":
	 * "duvmdjvfec", "LOGO":
	 * "http://img13.360buyimg.com/n3/g12/M00/04/10/rBEQYFGMttQIAAAAAAIfZpfeUtEAAA4VAFqa0MAAh9-952.jpg"
	 * , "DESC": "HTML", "MPRICE": 328, "ID": 1, "NUM": 202, "TYPEID": 1,
	 * "TITLE": "韩版2013夏装新款女装" } }
	 */

}
